#include <iostream>
#include <utility>
#include <thread>
#include <vector>
#include <memory>
#include <mutex>
#include "../lib/timer-wheel/flat-timer-wheel.h"


using namespace timewheel;

// --------------------------------------------------------------
class ClimbTask : public BaseTask {
public:
    ClimbTask(const std::string& taskId, std::string sign)
            : BaseTask(taskId), sign_(std::move(sign)) {
    }

    void execute() override {
        std::cout << "ClimbTask: " << getInfo() << std::endl;
    }
private:
    std::string sign_;
};


class BlockTask : public BaseTask {
public:
    BlockTask(const std::string& taskId, std::string sign)
            : BaseTask(taskId), sign_(std::move(sign)) {
    }

    void execute() override {
        // taskInfo  emit
        std::cout << "BlockTask: " << getInfo() << std::endl;
    }
private:
    std::string sign_;
};


int main() {
    TaskManager taskManager;

    int task_num = 180;
    Tick task_duration = 20 * 100;
    std::string sceneCode = "climb_belt";
    taskManager.registScene(sceneCode, task_duration);

    std::vector<std::shared_ptr<BaseTask>> tasks;
    for (int i = 1; i <= task_num; ++i) {
        std::shared_ptr<ClimbTask> task = std::make_shared<ClimbTask>("cameraId-" + std::to_string(i), "climbBelt-" + std::to_string(i));
        tasks.push_back(task);
    }
    taskManager.batchPutTask(sceneCode, tasks);


    std::string sceneCode2 = "block";
    taskManager.registScene(sceneCode2, task_duration);

    std::vector<std::shared_ptr<BaseTask>> tasks2;
    for (int i = 1; i <= task_num; ++i) {
        std::shared_ptr<BlockTask> task = std::make_shared<BlockTask>("cameraId-" + std::to_string(i), "climbBelt-" + std::to_string(i));
        tasks2.push_back(task);
    }
    taskManager.batchPutTask(sceneCode, tasks2);


    taskManager.start();

    std::this_thread::sleep_for(std::chrono::seconds (1000));
    return 0;
}
